export default {
    mounted(el) {
        const oSelectorInput = el.querySelector('.selector-input'),
              oSelectorMenu = el.querySelector('.selector-menu')

        const oPlaceholder = oSelectorInput.querySelector('label'),
            oInput = oSelectorInput.querySelector('input'),
            oIcon = oSelectorInput.querySelector('span')

        oInput.addEventListener('focus', () => {
            oPlaceholder.style.display = 'none'
            oIcon.className = "iconfont icon-sousuo"
            oSelectorMenu.style.display = 'block'
        }, false)

        oInput.addEventListener('blur', function (){

            oIcon.className = "iconfont icon-zhankai"

            setTimeout(() => {
                if(!this.value.length)
                    oPlaceholder.style.display = 'block'
                oSelectorMenu.style.display = 'none'
            }, 300)
        }, false)
    }
}